home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The CICA Windows Explosion!
/
The CICA Windows Explosion! - Disc 1.iso
/
util
/
printps.zip
/
PSDRV.C
< prev
Wrap
C/C++ Source or Header
|
1994-01-19
|
5KB
|
156 lines
#define lineentete 815
#define firstline 795
#define __MSC /* For Borland C++ */
#include <bios.h>
#include <stdio.h>
#include <string.h>
/* PSDRV.C */
void PrintProlog() ;
void PrintEnd() ;
void SelectCourier (int corps) ;
void SelectTimes (int corps) ;
void SelectHelv (int corps) ;
void PrintTextAt(int x,int y,unsigned char * text) ;
/* PRINTPS.C */
void SendText(char *pText) ;
void PrintProlog()
{
SendText("%!PS-Adobe-2.0 EPSF-1.2\n") ;
SendText("%%BoundingBox: 0 0 611 827\n") ;
SendText("%%Creator: Gilles Vollant\n") ;
SendText("%%Title: PrintPS file\n") ;
SendText("%%CreationDate: 11/8/91 12:00\n") ;
SendText("%%DocumentFonts:Courier Times-Roman\n") ;
SendText("%%DocumentNeeddedFonts: Courier Times-Roman\n") ;
SendText("%%IncludeFont: Courier Times-Roman\n") ;
SendText("%%EndComments\n") ;
SendText("/begdict 30 dict def\n") ;
SendText("begdict begin\n") ;
SendText("/reencsmalldict 12 dict def\n") ;
SendText("/ReEncodeSmall\n") ;
SendText("{ reencsmalldict begin\n") ;
SendText("/newcodesandnames exch def\n") ;
SendText("/newfontname exch def\n") ;
SendText("/basefontname exch def\n") ;
SendText("/basefontdict basefontname findfont def\n") ;
SendText("/newfont basefontdict maxlength dict def\n") ;
SendText("basefontdict\n") ;
SendText("{ exch dup /FID ne\n") ;
SendText("{ dup /Encoding eq\n") ;
SendText("{ exch dup length array copy newfont 3 1 roll put }\n") ;
SendText("{ exch newfont 3 1 roll put }\n") ;
SendText("ifelse }\n") ;
SendText("{pop pop }\n") ;
SendText("ifelse }\n") ;
SendText("forall\n") ;
SendText("newfont /FontName newfontname put\n") ;
SendText("newcodesandnames aload pop\n") ;
SendText("newcodesandnames length 2 idiv\n") ;
SendText("{ newfont /Encoding get 3 1 roll put}\n") ;
SendText("repeat newfontname newfont definefont pop\n") ;
SendText("end }\n") ;
SendText("def\n") ;
SendText("/spanvec [\n") ;
SendText("8#200 /Ccedilla 8#201 /udieresis 8#202 /eacute 8#203\n") ;
SendText("/acircumflex 8#204 /adieresis 8#205 /agrave 8#206 /aring 8#207\n") ;
SendText("/ccedilla 8#210 /ecircumflex 8#211 /edieresis 8#212 /egrave\n") ;
SendText("8#213 /idieresis 8#214 /icircumflex 8#215 /igrave 8#216\n") ;
SendText("/Adieresis 8#217 /Aring 8#220 /Eacute 8#221 /ae 8#222 /AE 8#223\n") ;
SendText("/ocircumflex 8#224 /odieresis 8#225 /ograve 8#226 /ucircumflex\n") ;
SendText("8#227 /ugrave 8#230 /ydieresis 8#231 /Odieresis 8#232\n") ;
SendText("/Udieresis 8#233 /oslash 8#234 /sterling 8#235 /Oslash 8#240\n") ;
SendText("/aacute 8#241 /iacute 8#242 /oacute 8#243 /uacute 8#244 /ntilde\n") ;
SendText("8#245 /Ntilde 8#246 /ordfeminine 8#247 /ordmasculine 8#250\n") ;
SendText("/questiondown 8#251 /endash 8#255 /exclamdown 8#256\n") ;
SendText("/guillemotleft 8#257 /guillemotright 8#341 /germandbls 8#345\n") ;
SendText("/space 8#346 /u 8#347 /space 8#350 /space 8#351 /space 8#365\n") ;
SendText("/section 8#366 /dotlessi 8#370 /ring 8#376 /endash\n") ;
SendText("] def\n") ;
SendText("end\n") ;
SendText("save begdict begin\n") ;
SendText("1 setlinewidth 0 setlinecap 0 setlinejoin [] 0 setdash\n") ;
SendText("0 setgray 10 setmiterlimit\n") ;
SendText("/Helvetica /IntlHelvetica spanvec ReEncodeSmall\n") ;
SendText("/Courier /IntlCourier spanvec ReEncodeSmall\n") ;
SendText("/Times-Roman /IntlTimes-Roman spanvec ReEncodeSmall\n") ;
SendText("newpath\n") ;
SendText("%%EndProlog\n\n") ;
}
void PrintEnd()
{
SendText("end restore currentfile closefile\n");
}
void PrintPage()
{
SendText("showpage\n") ;
}
void SelectTimes (int corps)
{
char line[80] ;
sprintf(line,
"%d /IntlTimes-Roman findfont exch scalefont setfont\n",corps) ;
SendText(line) ;
}
void SelectHelv (int corps)
{
char line[80] ;
sprintf(line,"%d /IntlHelvetica findfont exch scalefont setfont\n",corps) ;
SendText(line) ;
}
void SelectCourier (int corps)
{
char line[80] ;
sprintf(line,"%d /IntlCourier findfont exch scalefont setfont\n",corps) ;
SendText(line) ;
}
void ConvOctal (char * buf, unsigned char c,int lg)
{
char ch[20] ;
int i ;
sprintf(ch,"%o",c) ;
for (i = 0;(int)((i + strlen(ch))) < lg;i++,buf++) *buf = '0' ;
strcpy(buf,ch) ;
}
void PrintTextAt(int x,int y,unsigned char * text)
{
char line[512] ;
int i = 1 ;
sprintf(line,"%d %d moveto\n",x,y) ;
SendText (line) ;
line[0] = '(' ;
while ((*(text) != '\0') && (i+3) < 255)
{
if (*text == ')' || *text == '(' || *text == '\\')
line[i++] = '\\' ;
if (*text >= 32 && *text <= 128)
line[i++] = *text ;
else
{
line[i++] = '\\' ;
ConvOctal(&line[i],*text,3) ;
i += 3 ;
}
text ++ ;
}
line[i] = '\0' ;
strcat(line,") show\n") ;
SendText(line) ;
}